<template>
    <div>
        <el-pagination v-model:current-page="params.pageNo" :page-size="params.pageSize"
            layout="total, prev, pager, next" :total="props.total" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
    </div>
</template>
<script setup>
import { onMounted, ref } from 'vue'

const props = defineProps(["params", "total"])
const emit = defineEmits(["changepage"])
const params = ref({})
const handleCurrentChange = (e) => {
    params.value.pageNo = e;
    emit("changepage", params.value)
}
const handleSizeChange = (e) => {
    params.value.pageSize = e;
    emit("changepage", params.value)
}
onMounted(() => {
    console.log(props)
    params.value.pageNo = props.params.pageNo
    params.value.pageSize = props.params.pageSize
})
defineExpose({
    handleSizeChange,
    handleCurrentChange
})
</script>